package com.example.fw;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

import org.netbeans.jemmy.operators.JTreeOperator;

public class TreeHelper extends HelpersBase {

	
	private String rowName;

	public TreeHelper(ApplicationManager applicationManager) {
		super(applicationManager);
		}
		
		public void chooseGroup() {
			JTreeOperator tree = new JTreeOperator(mainFrame);
			tree.selectRow(0);
		}

		public String readNameOfFolder() {
			JTreeOperator tree = new JTreeOperator(mainFrame);
			tree.selectRow(0);
						
			Pattern p = Pattern.compile("\\w*]");
			Matcher jTreeValue= p.matcher(tree.getSelectionPath().toString());
			if (jTreeValue.find()){
			rowName = jTreeValue.group(0);
			}
					
			Pattern p2 = Pattern.compile("[A-Za-z0-9]*");
			jTreeValue = p2.matcher(rowName);
			if (jTreeValue.find()){
			rowName = jTreeValue.group(0);
			}
		
			return rowName;
		}
		
		 
}
